

<!DOCTYPE html>
<!--[if IE 8]><html class="no-js lt-ie9" lang="zh-CN" > <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="zh-CN" > <!--<![endif]-->
<head>
  <meta charset="utf-8">
  
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  
  <title>网络访问受限时的部署方法 &mdash; WeIdentity  文档</title>
  

  
  
  
  

  

  
  
    

  

  <link rel="stylesheet" href="../_static/css/theme.css" type="text/css" />
  <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
  <link rel="stylesheet" href="../_static/theme_overrides.css" type="text/css" />
  <link rel="stylesheet" href="../_static/index.css" type="text/css" />
    <link rel="index" title="索引" href="../genindex.html" />
    <link rel="search" title="搜索" href="../search.html" /> 

  
  <script src="../_static/js/modernizr.min.js"></script>

</head>

<body class="wy-body-for-nav">

   
  <div class="wy-grid-for-nav">

    
    <nav data-toggle="wy-nav-shift" class="wy-nav-side">
      <div class="wy-side-scroll">
        <div class="wy-side-nav-search">
          

          
            <a href="../index.html" class="icon icon-home"> WeIdentity
          

          
          </a>

          
            
            
          

          
<div role="search">
  <form id="rtd-search-form" class="wy-form" action="../search.html" method="get">
    <input type="text" name="q" placeholder="Search docs" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>
</div>

          
        </div>

        <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
          
            
            
              
            
            
              <p class="caption"><span class="caption-text">Contents:</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../README.html">什么是 WeIdentity？</a></li>
<li class="toctree-l1"><a class="reference internal" href="one-stop-experience.html">WeIdentity 一站式体验</a></li>
<li class="toctree-l1"><a class="reference internal" href="terminologies.html">术语</a></li>
<li class="toctree-l1"><a class="reference internal" href="use-cases.html">使用场景</a></li>
<li class="toctree-l1"><a class="reference internal" href="weidentity-spec.html">WeIdentity 规范</a></li>
<li class="toctree-l1"><a class="reference internal" href="weidentity-installation.html">WeIdentity Java SDK 安装部署</a></li>
<li class="toctree-l1"><a class="reference external" href="https://weidentity.readthedocs.io/projects/javasdk/zh_CN/latest/">WeIdentity Java SDK 文档</a></li>
<li class="toctree-l1"><a class="reference internal" href="weidentity-sample.html">WeIdentity Sample 开发样例</a></li>
<li class="toctree-l1"><a class="reference internal" href="miscellaneous.html">杂项</a></li>
<li class="toctree-l1"><a class="reference internal" href="faq.html">FAQ</a></li>
<li class="toctree-l1"><a class="reference internal" href="weidentity-rest.html">WeIdentity RestService</a></li>
<li class="toctree-l1"><a class="reference internal" href="weidentity-endpoint.html">WeIdentity Endpoint Service</a></li>
<li class="toctree-l1"><a class="reference internal" href="weidentity-contract-design.html">WeIdentity 智能合约设计与实现</a></li>
</ul>

            
          
        </div>
      </div>
    </nav>

    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">

      
      <nav class="wy-nav-top" aria-label="top navigation">
        
          <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
          <a href="../index.html">WeIdentity</a>
        
      </nav>


      <div class="wy-nav-content">
        
        <div class="rst-content">
        
          















<div role="navigation" aria-label="breadcrumbs navigation">

  <ul class="wy-breadcrumbs">
    
      <li><a href="../index.html">Docs</a> &raquo;</li>
        
      <li>网络访问受限时的部署方法</li>
    
    
      <li class="wy-breadcrumbs-aside">
        
            
            <a href="../_sources/docs/how-to-run-without-internet.rst.txt" rel="nofollow"> View page source</a>
          
        
      </li>
    
  </ul>

  
  <hr/>
</div>
          <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
           <div itemprop="articleBody">
            
  <div class="section" id="id1">
<h1>网络访问受限时的部署方法<a class="headerlink" href="#id1" title="永久链接至标题">¶</a></h1>
<p>WeIdentity-Java-SDK及其部署工具默认需要连接到Internet，以访问Maven中央仓库去下载所需的依赖库。
当您访问Internet受限时，根据您是否可访问自建的仓库服务（如企业内部搭建的仓库），本文提供了两种部署解决方案：</p>
<div class="section" id="id2">
<h2>有自建仓库服务<a class="headerlink" href="#id2" title="永久链接至标题">¶</a></h2>
<p>如果您需要自建Maven仓库，请查阅<a class="reference external" href="https://www.theserverside.com/news/1364121/Setting-Up-a-Maven-Repository">此链接</a>。
文中详尽地介绍了基于Artifactory或Nexus OSS的多种自建Maven仓库，以及从中央仓库拉取jar包的方法。</p>
<p>当您的自建仓库可以使用时，您需要更改默认的maven仓库地址及build.gradle里的仓库地址，使得它能够被正确指向。您可参阅
<a class="reference external" href="https://discuss.gradle.org/t/mavenlocal-how-does-gradle-resolve-the-directory-of-the-local-maven-repository/4407">此链接</a>
了解如何修改默认的maven仓库地址配置。</p>
</div>
<div class="section" id="id3">
<h2>无自建仓库服务<a class="headerlink" href="#id3" title="永久链接至标题">¶</a></h2>
<p>如果您没有自建仓库的打算，或者您的部署环境无法连接到除了区块链节点以外的Internet环境，那么下面将介绍从Java-SDK 1.3.0
开始，新引入的离线编译功能。此功能可以支持您在无Internet环境下weid-java-sdk及部署工具build-tools的编译与部署。</p>
<div class="section" id="id4">
<h3>前提条件<a class="headerlink" href="#id4" title="永久链接至标题">¶</a></h3>
<p>您仍需要在部署的机器上预先安装好Gradle、JDK环境，详见<a class="reference external" href="./weidentity-installation.html">WeIdentity JAVA SDK安装部署文档</a>中的“准备工作”一节。</p>
</div>
<div class="section" id="id5">
<h3>流程<a class="headerlink" href="#id5" title="永久链接至标题">¶</a></h3>
<p>1, 拉取部署工具或Java-SDK的代码。</p>
<p>2, 您需要在有网络的环境下运行编译命令，拉取所有的依赖库。</p>
<p>如果您使用的是部署工具build-tools，请运行：</p>
<div class="highlight-shell notranslate"><div class="highlight"><pre><span></span>./compile.sh
</pre></div>
</div>
<p>如果您准备直接编译Java-SDK，请运行：</p>
<div class="highlight-shell notranslate"><div class="highlight"><pre><span></span>gradle build
</pre></div>
</div>
<p>当执行完成后，您应该在dist/lib/目录里看到所有的依赖库已经下载完毕。</p>
<p>3, 将依赖库拷贝到无网环境下的部署机器中。</p>
<p>具体地，不论是部署工具还是Java-SDK，您只需将所有的依赖库拷贝到代码目录下dist/lib/中即可。如果此目录不存在，请新建一个。</p>
<p>4, 执行离线编译命令。</p>
<p>如果您使用的是部署工具build-tools，请运行下面的命令进行离线编译及部署：</p>
<div class="highlight-shell notranslate"><div class="highlight"><pre><span></span>./compile.sh --offline
./deploy.sh
</pre></div>
</div>
<p>如果您准备直接编译Java-SDK，请运行下面的命令进行离线编译及组装：</p>
<div class="highlight-shell notranslate"><div class="highlight"><pre><span></span>gradle build --offline
</pre></div>
</div>
</div>
</div>
</div>


           </div>
           
          </div>
          <footer>
  

  <hr/>

  <div role="contentinfo">
    <p>
        &copy; Copyright (2018) WeBank Co., Ltd.

    </p>
  </div>
  Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/rtfd/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>. 

</footer>

        </div>
      </div>

    </section>

  </div>
  


  

    
    
      <script type="text/javascript" id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script>
        <script src="../_static/jquery.js"></script>
        <script src="../_static/underscore.js"></script>
        <script src="../_static/doctools.js"></script>
        <script src="../_static/language_data.js"></script>
        <script src="../_static/translations.js"></script>
    

  

  <script type="text/javascript" src="../_static/js/theme.js"></script>

  <script type="text/javascript">
      jQuery(function () {
          SphinxRtdTheme.Navigation.enable(true);
      });
  </script> 

</body>
</html>